package com.fauks.ssm.springmvc.converter;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * 支持数据校验的bean
 */
public class ValidatorBean {
    @NotEmpty(message = "姓名不能为空")
    @Size(min = 3, max = 6, message = "最小{min},最大{max}")
    private String name;
    /*支持正则表达式*/
    @Pattern(regexp = "^1[34578]\\d{9}$", message = "手机号格式错误")
    private String mobile;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    @Override
    public String toString() {
        return "ValidatorBean{" +
                "name='" + name + '\'' +
                ", mobile='" + mobile + '\'' +
                '}';
    }
}
